package com.Thread.demo01;

public class Test01 {
    public static void main(String[] args) {
        Object objA = new Object();
        Object objB = new Object();
        new Thread(() -> {
            while (true) {
                synchronized (objA) {
                    synchronized (objB) {
                        System.out.println("一号测试");
                    }
                }
            }
        }).start();
        new Thread(() -> {
            while (true) {
                synchronized (objB) {
                    synchronized (objA) {
                        System.out.println("二号测试");
                    }
                }
            }
        }).start();
    }
}
